Copying response properties
This feature allows you to copy properties from an HTTP response object to another stream. In this code sample, an HTTP GET request is made, and the response is piped through a new PassThrough stream, but before that, all properties of the original response are copied to the new stream using mimicResponse.
const http = require('http');
const mimicResponse = require('mimic-response');
http.get('http://example.com', (res) => {
const customResponse = new stream.PassThrough();
mimicResponse(res, customResponse);
res.pipe(customResponse);
});